/**
 */
package org.mro.grib.model.general.impl;

import java.util.Collection;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;

import org.mro.grib.model.general.Context;
import org.mro.grib.model.general.generalPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Context</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.mro.grib.model.general.impl.ContextImpl#getGribFiles <em>Grib Files</em>}</li>
 *   <li>{@link org.mro.grib.model.general.impl.ContextImpl#getGribTables <em>Grib Tables</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ContextImpl extends EObjectImpl implements Context {
	/**
	 * The cached value of the '{@link #getGribFiles() <em>Grib Files</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGribFiles()
	 * @generated
	 * @ordered
	 */
	protected EList<String> gribFiles;

	/**
	 * The cached value of the '{@link #getGribTables() <em>Grib Tables</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGribTables()
	 * @generated
	 * @ordered
	 */
	protected EList<String> gribTables;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ContextImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return generalPackage.Literals.CONTEXT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getGribFiles() {
		if (gribFiles == null) {
			gribFiles = new EDataTypeUniqueEList<String>(String.class, this, generalPackage.CONTEXT__GRIB_FILES);
		}
		return gribFiles;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getGribTables() {
		if (gribTables == null) {
			gribTables = new EDataTypeUniqueEList<String>(String.class, this, generalPackage.CONTEXT__GRIB_TABLES);
		}
		return gribTables;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case generalPackage.CONTEXT__GRIB_FILES:
				return getGribFiles();
			case generalPackage.CONTEXT__GRIB_TABLES:
				return getGribTables();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case generalPackage.CONTEXT__GRIB_FILES:
				getGribFiles().clear();
				getGribFiles().addAll((Collection<? extends String>)newValue);
				return;
			case generalPackage.CONTEXT__GRIB_TABLES:
				getGribTables().clear();
				getGribTables().addAll((Collection<? extends String>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case generalPackage.CONTEXT__GRIB_FILES:
				getGribFiles().clear();
				return;
			case generalPackage.CONTEXT__GRIB_TABLES:
				getGribTables().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case generalPackage.CONTEXT__GRIB_FILES:
				return gribFiles != null && !gribFiles.isEmpty();
			case generalPackage.CONTEXT__GRIB_TABLES:
				return gribTables != null && !gribTables.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (gribFiles: ");
		result.append(gribFiles);
		result.append(", gribTables: ");
		result.append(gribTables);
		result.append(')');
		return result.toString();
	}

} //ContextImpl
